﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OrderExer
{
    internal class Commodity
    {
        private string name;//商品名字
        private string date;//商品生产日期

        public Commodity(string name,string date)
        {
            this.Name = name;
            this.Date = date;
        }

        public string Name { get => name; set => name = value; }
        public string Date { get => date; set => date = value; }

        public override bool Equals(object obj)
        {
            return obj is Commodity commodity &&
                   Date == commodity.Date;
        }

        public override int GetHashCode()
        {
            return HashCode.Combine(Date);
        }

        public override string ToString()
        {
            return "商品生产日期:" + this.Date;
        }
    }
}
